<!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>
	Php and the MySQLi API
</title>

</head>
<body>
<?php
/*
echo "<h1>MySQLi procedural</h1>";
$db = mysqli_connect("localhost","root")or die("couldn't connect");
mysqli_select_db($db,"mickbrog_wrdp1");
$result = mysqli_query($db, "SELECT post_excerpt from wp_posts where post_excerpt is not null");
echo "Hello World";
while($row = mysqli_fetch_assoc($result)){
	print $row['post_title']."\n";
	print $row['post_excerpt']."\n";	
}
mysqli_free_result($result);
mysqli_close($db);


echo "<h1>New mysqli  object oriented interface</h1>";
$search_string ="Vejigantes" ;

$mysqli = new mysqli("localhost","root") or die("couldn't connect sorry");
$mysqli->select_db("mickbrog_wrdp1");
$result = $mysqli->query("SELECT post_content from wp_posts where post_content like '%Vejigante%'");
while($row = $result->fetch_assoc())
{
	print "<p>".$row['post_content']."</p>";	
}*/
?>
<?php 
echo "<h1>Prepared Statements</h1>";
$db = mysqli_connect("localhost","root")or die("couldn't connect");
$username = "rasmus";
$password = "z.8cMpdFbNAPw";
$id = 503;

$sql = "SELECT post_content FROM wp_posts where id =(?)";
$stmt = mysqli_stmt_init($db);
if(mysqli_stmt_prepare($stmt,$sql)){
	mysqli_stmt_bind_param($stmt,'i',$id);
	mysqli_bind_result($stmt,$result);
	mysqli_statement_execute($stmt);
	while(mysqli_stmt_fetch($stmt)){
		print "$result";
	}	
}



?>

</body>
</html>
<?php 


?>